<?php

class spString
{
	static public function removeEdge( $char, $string )
	{
		while ( substr($string, -1)==$char )
			$string = substr($string,0,-1);
			
		while ( substr($string, 0, 1)==$char )
			$string = substr($string,1);
			
		return $string;
	}
	
	static public function csvUnique( $string, $removeEmpty=true )
	{
		if ( $string=="" )
			return "";
	
		$arString = explode( ",", $string );
		
		if ( $removeEmpty==true )
		{
			$ar = array();
			foreach ( $arString as $a )
			{
				if ( $a=="" )
					continue;
				
				$ar[] = $a;
			}
			
			$arString = $ar;
		}
		
		$arString = array_unique($arString);
		$string = implode( ",", $arString );
		return $string;
	}
}

?>